<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/3/19
 * Time: 11:18
 */

namespace App;


use Illuminate\Database\Eloquent\Model;

class GoodsMappingOrder extends Model
{
    //指定表名
    protected $table='goods_mapping_order';
    //指定id
    protected $primaryKey ='id';
    // 日期都存储为时间戳
    protected $dateFormat = 'U';

    // 将钱数改变面额单位从元换算成分
    public function setPriceAttribute($value)
    {
        $this->attributes['price'] = $value*100;
    }
    // 将钱数改变面额单位从分换算成元
    public function getPriceAttribute($value)
    {
        return $value/100;
    }
}